//
//  UIViewController+PopGestureEnable.m
//  XYWallet
//
//  Created by apple on 2022/3/29.
//

#import "UIViewController+PopGestureEnable.h"

@implementation UIViewController (PopGestureEnable)

+ (void)popGestureClose:(UIViewController *)viewController {
    
    // 禁用侧滑返回手势
    if ([viewController.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        //这里对添加到右滑视图上的所有手势禁用
        for (UIGestureRecognizer *popGesture in viewController.navigationController.interactivePopGestureRecognizer.view.gestureRecognizers) {
            popGesture.enabled = NO;
        }
    }
}

+ (void)popGestureOpen:(UIViewController *)viewController {
    
    // 启用侧滑返回手势
    if ([viewController.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        //这里对添加到右滑视图上的所有手势启用
        for (UIGestureRecognizer *popGesture in viewController.navigationController.interactivePopGestureRecognizer.view.gestureRecognizers) {
            popGesture.enabled = YES;
        }
    }
}

@end
